import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {path: '/', redirect: '/login'},
    {path: '/manager',meta: {title: '管理'}, name: 'manager', component: () => import('../views/Manager.vue'), children: [
        {path: 'home',meta: {title: '首页'}, name: 'home', component: () => import('../views/Home.vue')},
            {path: 'user',meta: {title: '用户'}, name: 'user', component: () => import('../views/User.vue')},
            {path: 'admin',meta: {title: '管理员'}, name: 'admin', component: () => import('../views/Admin.vue')},
            {path: 'person',meta: {title: '个人信息'}, name: 'person', component: () => import('../views/Person.vue')},
        ]},
      { path: '/404', name: 'NotFound', meta: { title: '404找不到页面' },  component: () => import('../views/404.vue') },
      { path: '/:pathMatch(.*)', redirect: '/404' },
      {path:'/login', name: 'login',meta: {title: '登录页面'}, component: () => import('../views/Login.vue')},
      {path:'/register', name: 'register',meta: {title: '注册页面'}, component: () => import('../views/Register.vue')}
  ],
})

export default router
